#!/usr/bin/bash

# 读取键盘输入  -p 提示语
read -p "please input ip: " ip

ping -c1 $ip &>/dev/null
if [ $? -eq 0 ];then
    echo "$ip is up"
else
    echo "$ip is down"
fi